<div class="resultDataContainer"></div>
<?php if($this->blocksError)://kontrola ci ma pridelene presne dva odborne bloky?>
	<p class="notice">Trieda <strong><?php echo $this->group->Zkratka ;?></strong> nemá pridelený odborný blok</p>
<?php elseif ($this->harmonogram == null)://kontrola ci ma student prideleny harmonogram?>
	<p class="notice">Študent nemá pridelený harmonogram</p>
<?php elseif(isset($this->questionNumberForm))://ak nema pridelene cislo otazky tak zobraz formular?>
	<?php echo $this->questionNumberForm; ?>
<?php else: ?>	
	<?php 
		$i = 0;
		foreach($this->blocks as $block):		
	?>
	<table>
		<tr>
			<th class="left">Odborný blok: <?php echo $block->name?></th>
			<th colspan="2">
				<?php	
					$blockTime = 'block' . ($i + 1);									
					if($this->harmonogram->$blockTime != null){						
						$date = new Zend_Date($this->harmonogram->$blockTime,'YYYY-mm-dd');											
						echo $date->toString("dd.mm.YYYY");						
					}
				?>
			</th>			
		</tr>		
		
	<?php	
		foreach ($block->getSubjects() as $subject):
			$grade = null;
			$note = null;
			$rid = null;
			if(!empty($this->results)){
				foreach($this->results as $result){
					if($result->sid == $subject->sid){					
						$rid = $result->rid;
						$grade = $result->grade;
						$note = $result->note;									
					}
				}								
			}
	?>		
		<tr <?php echo $grade != null ? 'class="done"' : null?>>
			<td class="left">
				<?php echo $subject->getName(); ?>
			</td>
			
			<!-- NEPOUZIVA SA
			<td class="left">			
					<a href="#" onClick="javascript:$.post(
							'<?php echo $this->url(array(
								'controller' => 'result',
								'action' => 'show-block',
								'format' => 'html',
								'bid' => $block->bid
							)
						) ?>',
						{
							ID_st: <?php echo $this->harmonogram->ID_st; ?>,
							ID_tr: <?php echo $this->group->ID_tr; ?>,
							bid: <?php echo $block->bid; ?>
						},
						function(result){
							$('#dialogContainer').dialog('open');
							$('#dialogContainer').html(result);
						});">
							<?php echo $block->getName(); ?>													
							</a>
				
			</td>			
			<td class="right">
				<?php	
					$blockTime = 'block' . ($i + 1);									
					if($this->harmonogram->$blockTime != null){						
						$date = new Zend_Date($this->harmonogram->$blockTime,'YYYY-mm-dd');											
						echo $date->toString("dd.mm.YYYY");						
					}
					else {
						echo 'Nie je pridelený';
					}
				?>
			</td>
			KONIEC -->
			
			<td class="center">
				<a class="actionIcon addAction" href="#" onClick="javascript:$.post(
							'<?php echo $this->url(array(
								'controller' => 'result',
								'action' => 'show-result-dialog',
								'format' => 'html',								
								'sid' => $subject->sid,
								'rid' => ($rid != null) ? $rid : null,
								'note' => ($note != null) ? $note : null,
							)
						) ?>',
						{
							ID_st: <?php echo $this->harmonogram->ID_st; ?>,
							sid: <?php echo $subject->sid; ?>							
							<?php if($rid != null) echo ',rid:' . "'$rid'"; ?>
							<?php if($grade != null) echo ',grade:' . "'$grade'"; ?>
							<?php if($note != null) echo ',note:' . "'$note'"; ?>
						},
						function(result){
							$('#dialogContainer').dialog('open');
							$('#dialogContainer').html(result);
						});">
							<?php
							echo $grade == null ? 'Pridať hodnotenie' : 'Pridelene hodnotenie: ' . $grade;
							?>													
							</a>
			</td>
			<!-- <td>
				<?php if(isset($harmonogram['qid'])):?>						
										
					<a href="#" onClick="javascript:$.post(
							'<?php echo $this->url(array(
								'controller' => 'result',
								'action' => 'show-question-dialog',
								'format' => 'html' 
							)
						) ?>',
						{
							studentID: <?php echo $harmonogram['ID_st']; ?>,
							subjectID: <?php echo $harmonogram['sid']; ?>,
							questionID:<?php echo $harmonogram['qid']; ?>
						},
						function(result){
							$('#dialogContainer').dialog('open');
							$('#dialogContainer').html(result);
						});">Otázka</a>
						
						
					|
					
					<a href="#" onClick="javascript:$.post(
							'<?php echo $this->url(array(
								'controller' => 'result',
								'action' => 'show-result-dialog',
								'format' => 'html' 
							)
						) ?>',
						{
							studentID: <?php echo $harmonogram['ID_st']; ?>,
							subjectID: <?php echo $harmonogram['sid']; ?>,
							commissionID:<?php echo $harmonogram['cid']; ?>
						},
						function(result){
							$('#dialogContainer').dialog('open');
							$('#dialogContainer').html(result);
						});">Pridať hodnotenie</a>
			
				<?php else: ?>
					Predmet neobsahuje otázku so zvoleným číslom
				<?php endif;?>	
					
			</td> -->	
		</tr>
		<?php endforeach;?>		
	</table>
	<?php $i++; endforeach;?>
	
	<table>		
		<tr><th colspan="2">Bakalárska práca</th></tr>		
		<tr>
			<td class="left">				
				<?php echo $this->thesis;?>									
			</td>
			<td class="right">
				<?php 
					if(isset($this->thesisMarkForm)){
						echo $this->thesisMarkForm;
					}
				?>
			</td>
		</tr>		
	</table>
	
<?php endif; ?>